def us_tick_blp_price():	
	dest_db_conn = DBConnFactory().get_db_connection('PKEDB')
	
	#tick = 'GRO UN Equity'
	#start_date = date(2007,11,6)
	#end_date = date(2007,11,7)
	
	#tick = 'HRAY US Equity'	
	#start_date = date(2009,12,15)
	#end_date = date(2010,1,18)
	
	tick = 'SNP UN Equity'	
	start_date = date(2009,5,1)
	end_date = date(2009,5,20)
	
	tick_list = [tick]
	rsp = query_blp_data(tick_list, ['PX_LAST'], start_date, end_date)
	#print rsp
	#print rsp[tick].values()
	#return 
	
	r = [(item['date'],tick,item['PX_LAST']) for item in rsp[tick].values()]	
	print r
	
	if len(r)>0:
		dest_db_conn.cursor().executemany('''merge into comm_security_daily_price p
								using (select :1 d,:2 tk,:3 v from dual) t
									on (p.ref_date=TO_DATE(t.d,'yyyy-mm-dd') and t.tk=p.ticker)
								when matched then update 
									set p.close_price=t.v
								when not matched then insert 
									values(TO_DATE(t.d,'yyyy-mm-dd'),t.tk,t.v)''', r)
		dest_db_conn.commit()	